package cn.piesat.scanning.service.impl;

import cn.piesat.scanning.dao.DbDmsValidationMetricsDataDAO;
import cn.piesat.scanning.dao.DbDmsValidationProductDataDAO;
import cn.piesat.scanning.service.DbDmsValidationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zyp
 * @date 2021/4/29
 */
@Service
public class DbDmsValidationServiceImpl implements DbDmsValidationService {

    @Autowired
    private DbDmsValidationMetricsDataDAO dbDmsValidationMetricsDataDAO;
    @Autowired
    private DbDmsValidationProductDataDAO dbDmsValidationProductDataDAO;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteByTaskPlanIdIn(List<String> deleteTaskPlanIds) {
        dbDmsValidationMetricsDataDAO.deleteByTaskPlanIdIn(deleteTaskPlanIds);
        dbDmsValidationProductDataDAO.deleteByTaskPlanIdIn(deleteTaskPlanIds);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteByFileDateIn(List<String> deleteFileDates) {
        dbDmsValidationMetricsDataDAO.deleteByFileDateIn(deleteFileDates);
        dbDmsValidationProductDataDAO.deleteByFileDateIn(deleteFileDates);
    }
}
